package 代码随想录_补充题目.字符串反转系列;

/**
 * @author zx
 * @create 2023-02-08 23:01
 */
public class 剑指Offer05_替换空格 {
    public String replaceSpace(String s) {
        StringBuilder res = new StringBuilder();
        for(int i = 0;i < s.length();i++){
            if(s.charAt(i) == ' '){
                res.append("%20");
            }else{
                res.append(s.charAt(i));
            }
        }
        return res.toString();
    }
}
